package com.forum.module.blog.convert.article_tag;

import com.forum.framework.common.util.colletion.CollectionUtils;
import com.forum.framework.common.util.object.BeanUtils;
import com.forum.module.blog.controller.article.vo.ArticleRespVO;
import com.forum.module.blog.controller.article_tag.vo.ArticleTagRespVO;
import com.forum.module.blog.convert.article.ArticleConvert;
import com.forum.module.blog.dal.dataobject.article.ArticleDO;
import com.forum.module.blog.dal.dataobject.article_tag.ArticleTagDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 功能:
 * 作者:ouyzh
 * 日期:2025/3/4 19:35
 */
@Mapper
public interface ArticleTagConvert {
    ArticleTagConvert INSTANCE = Mappers.getMapper(ArticleTagConvert.class);

    default List<ArticleTagRespVO> covertList(List<ArticleTagDO> list) {
        return CollectionUtils.convertList(list, this::covert);
    }

    default ArticleTagRespVO covert(ArticleTagDO articleTagDO) {
        return BeanUtils.toBean(articleTagDO, ArticleTagRespVO.class);
    }
}
